<?php 
echo $this->Html->script('jquery');
echo $this->Html->css('../plugins/fancybox/jquery.fancybox-1.3.4');		
echo $this->Html->script('../plugins/fancybox/jquery.mousewheel-3.0.4.pack');
echo $this->Html->script('../plugins/fancybox/jquery.fancybox-1.3.4.pack');
echo $this->Html->script('fbplugin');
?>
<h1><?php echo $data['Image']['title']?></h1>

                
                	<div class="maintip">
                    <div class="image_wrapper detailImage">
                        <a class="fancy" href="<?php echo $this->webroot.'uploaded/Image/image/'.$data['Image']['image']?>" target="_parent">
                        	<img class="imageFix" widthFix="420" heightFix="330" src="<?php echo $this->webroot.'uploaded/Image/image/'.$data['Image']['image']?>" alt="<?php echo $data['Image']['title']?>" /></a>
                        </div>
                      
                       <?php if(!empty($prevImages)){
                       		for($i=count($prevImages)-1;$i>=0;$i--){
                       		$v=$prevImages[$i];
                       		$style='';
                       		if($i==count($prevImages)-1)$style='margin-left:0px';
                       		
                       	?>
	                       	<div class="image_wrapper otherImage" style="<?php echo $style?>">
	                        <a href="<?php echo $this->Seo->link('/lifes/detail/'.$v['Image']['id'].'/'.$locale)?>" target="_parent">
	                        	<img class="imageFix" widthFix="40" heightFix="40" src="<?php echo $this->webroot.'uploaded/Image/thumb/'.$v['Image']['image']?>" alt="<?php echo $v['Image']['title']?>" />
	                        </a>
	                        </div>                 
	                        
                       <?php }}?>
                       
                       <?php $style='';if(empty($prevImages))$style='margin-left:0px';?>
                       <div class="image_wrapper otherImage currentImage" style="<?php echo $style?>">
                        <a href="<?php echo $this->Seo->link('/lifes/detail/'.$data['Image']['id'].'/'.$locale)?>" target="_parent">
                        	<img class="imageFix" widthFix="40" heightFix="40" src="<?php echo $this->webroot.'uploaded/Image/thumb/'.$data['Image']['image']?>" alt="<?php echo $data['Image']['title']?>" />
                        	</a>
                        </div>
                        
                        
                         <?php if(!empty($nextImages)){
                         		foreach($nextImages as $k=>$v){
                         ?>
	                       	<div class="image_wrapper otherImage" >
	                        <a href="<?php echo $this->Seo->link('/lifes/detail/'.$v['Image']['id'].'/'.$locale)?>" target="_parent">
	                        <img class="imageFix" widthFix="40" heightFix="40" src="<?php echo $this->webroot.'uploaded/Image/thumb/'.$v['Image']['image']?>" alt="<?php echo $v['Image']['title']?>" /></a>
	                        </div>
	                        
	                        
                       <?php }}?>
                      
                    </div>
                    
                    <div class="othertip">
 
                        <ul id="service_list">
                        	<?php foreach($news as $k=>$v){
                        		
                        		?>
                        	
                        	<li><a href="<?php echo $this->Seo->link('/'.$v['News']['controller'].'/detail/'.$v['News']['id'].'/'.$locale)?>"><?php echo $v['News']['title']?></a></li>
                        	<?php }?>
                        </ul>
                    
                    </div>

<!-- facebook plugin -->
	<div>
		<div style="float:left;"><g:plusone size="medium" annotation="none"></g:plusone></div>
		<div style="float:left;margin-left:10px;" class="fb-like" data-href="<?php echo $this->Seo->link($ogUrl);?>" data-send="false" data-layout="button_count" data-width="10" data-show-faces="true"></div>
		<div  id="fbfacepile">
			<fb:facepile href="<?php echo $this->Seo->link($ogUrl);?>" width="300" max_rows="1"></fb:facepile>
		</div>
		<div style="clear:both;height:20px;"></div>
		
		
	</div>	
	<br />	
	<div class="fb-comments" data-href="<?php echo $this->Seo->link($ogUrl);?>" data-num-posts="<?php echo $webConfig['fbCommentNop']?>" data-width="550"></div>
	<div id="fb-root"></div>				
	<div style="clear:both;height:20px"></div>
	<!-- ===================== -->

<script type="text/javascript">



$("a.fancy").fancybox({
	'width'				: '100%',
	'height'			: '100%',
	'nextClick'			:true, 
	'autoScale'			: false,
	'transitionIn'		: 'none',
	'transitionOut'		: 'none'
		
	
});

//google
(function() {
  var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
  po.src = 'https://apis.google.com/js/plusone.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
//facebook
//for fb
var accessToken=0;
var uid=0;
var selfurl='<?php echo $this->Seo->link($ogUrl)?>';
fbplugin.selfurl=selfurl;
fbplugin.saveUserDataUrl='<?php echo $this->Seo->link('/fbs/saveuserdata');?>';
window.fbAsyncInit = function() {
    FB.init({
      appId      : '494778310568489', // App ID
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      xfbml      : true  // parse XFBML
    });


    
    FB.getLoginStatus(function(response) {
		  if (response.status === 'connected') {
		    // the user is logged in and has authenticated your
		    // app, and response.authResponse supplies
		    // the user's ID, a valid access token, a signed
		    // request, and the time the access token 
		    // and signed request each expire
		    fbplugin.uid = response.authResponse.userID;
		  	fbplugin.accessToken = response.authResponse.accessToken;
		    //call ajax show user config on this app
		    $('#fbstatus').load('<?php echo $this->Seo->link('/fbs/loaduserdata');?>'+'/'+fbplugin.uid);
		    
		  	
		  } else if (response.status === 'not_authorized') {
		    // the user is logged in to Facebook, 
		    // but has not authenticated your app
  		    document.getElementById('btnRead').style.display='block';
		  } else {
		    // the user isn't logged in to Facebook.
		  }

		  
		 });

    

    
  };

 
  (function(d){
      var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
      js = d.createElement('script'); js.id = id; js.async = true;
      js.src = "//connect.facebook.net/en_US/all.js";
      d.getElementsByTagName('head')[0].appendChild(js);
    }(document));
  /*
(function(d, s, id) {
	  var js, fjs = d.getElementsByTagName(s)[0];
	  if (d.getElementById(id)) return;
	  js = d.createElement(s); js.id = id;
	  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
	  fjs.parentNode.insertBefore(js, fjs);
	}(document, 'script', 'facebook-jssdk'));*/
function postRead()
{
	fbplugin.getPermission('publish_actions','loaduserdata();');
}
function loaduserdata(){
	$('#fbstatus').load('<?php echo $this->Seo->link('/fbs/loaduserdata');?>'+'/'+fbplugin.uid);
}





function openRecentActivity(){	
	$.fancybox({
			type : 'iframe',
			href: '<?php echo $this->Seo->link('/fbs/getuseractivity')?>'+'/'+fbplugin.uid +'/'+fbplugin.accessToken,
			padding : 5,
			width:500,
			height:500
	});

}
</script>